package com.kfm.dao;

import com.kfm.util.LoadDatasource;
import org.apache.commons.dbutils.QueryRunner;

import java.text.SimpleDateFormat;
import java.util.Date;

public class FileDao {

    public int insert(String name, long size, Date createTime, String ip, String link) throws Exception {
        QueryRunner runner = new QueryRunner(LoadDatasource.getDatasource());
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String time = sdf.format(createTime);
        String sql = "insert into `kfm_file`(name, size, create_time, upload_ip, download_link) values (?, ?, ?, ?, ?)";
        return runner.update(sql, name, size, createTime, ip, link);
    }
}
